package com.example.spgl.service.impl;

import com.example.spgl.mapper.ProductMapper;
import com.example.spgl.service.FileService;
import com.example.spgl.service.ProjectService;
import com.example.spgl.entity.Product;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class ProductServiceImpl implements ProjectService {
    @Autowired
    private ProductMapper productMapper;

    @Autowired
    private FileService fileService;
    @Override
    public List<Product> getlist() {
        List list = productMapper.list();
        return list;
    }

    @Override
    public void add(Product product) {

        log.info("要添加的商品为{}",product);
        productMapper.add(product);
    }

    @Override
    public void delete(int id) {
        productMapper.delete(id);
    }

    @Override
    public List<Product> pageList(Integer curPage, Integer pageSize) {
        return productMapper.pageList(curPage,pageSize);
    }

    @Override
    public int getCount() {
        return productMapper.getCount();
    }

    @Override
    public void update(Product product) {
        productMapper.update(product);
    }

    @Override
    public Product selectById(int id) {
        return productMapper.selectById(id);
    }

    @Override
    public void deleteProducts(String ids) {
        productMapper.deleteByIds(ids);
    }

    @Override
    public void reset() {
        productMapper.reset();
    }

}
